//
//  UILabel+CreatUI.m
//  QuXiang
//
//  Created by Duncan on 2020/6/28.
//  Copyright © 2020 NanHuaiZi. All rights reserved.
//

#import "UILabel+CreatUI.h"

@implementation UILabel (CreatUI)

+ (UILabel *)initWithTextColor:(UIColor *)textColor fontSize:(NSInteger)fontSize {
    UILabel *label = [[UILabel alloc] init];
    label.textColor = textColor;
    label.font = kAdaptedFontSize(fontSize);
    return label;
}

+ (UILabel *)initWithTextColor:(UIColor *)textColor boldFontSize:(NSInteger)fontSize {
    UILabel *label = [[UILabel alloc] init];
    label.textColor = textColor;
    label.font = kAdaptedBoldFontSize(fontSize);
    return label;
}

+ (UILabel *)initWithTextColor:(UIColor *)textColor weight:(UIFontWeight)weight size:(CGFloat)size {
    UILabel *label = [[UILabel alloc] init];
    label.textColor = textColor;
    label.font = [UIFont systemFontOfSize:kFragmemtFloat(size) weight:weight ?: UIFontWeightRegular];
    return label;
}

/// 添加中划线
- (void)addCenterLine {
    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:self.text attributes:attribtDic];
    self.attributedText = attribtStr;
}

@end
